import { statusMap } from "../../../utils/repairStatusMap";
Page({
  data: {
    repairList: [], // 维修列表数据
    statusMap,
  },
  onShow() {
    this.getRepairList();
  },
  goDetail(ev) {
    wx.navigateTo({
      url: "/repair_pkg/pages/detail/index?id=" + ev.mark.id,
    });
  },
  async getRepairList() {
    // 调用接口获取维修列表
    const { code, data } = await wx.http.get("/repair", {
      current: 1, // 当前页面
      pageSize: 10, // 每页多少条数据
    });
    if (code !== 10000) return wx.utils.toast();
    this.setData({
      repairList: data.rows,
    });
  },
  addRepair() {
    wx.navigateTo({
      url: "/repair_pkg/pages/form/index",
    });
  },
});
